home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
os2
/
adaptor.zip
/
ADAPT.ZIP
/
adaptor
/
examples
/
purdue
/
prob05.fcm
< prev
next >
Wrap
Text File
|
1993-06-26
|
3KB
|
117 lines
PROGRAM PROB05
C
C PROBLEM 5
C
C REFERENCE: PROBLEMS TO TEST PARALLEL AND VECTOR LANGUAGES
C CSD-TR 516, COMPUTER SCIENCE, PURDUE UNIVERSITY
C JOHN R. RICE, MAY 1, 1985
C
C REVISED BY JOHN R. RICE AND J. JING, OCT. 1, 1990
C
C
C *************************************************
C * Adapted for FORTRAN D benchmarking *
C * by T. HAUPT (haupt@sccs.npac.syr.edu) *
C * *
C * Northeast Parallel Architectures Center *
C * at Syracuse University, Syracuse, NY, USA *
C *************************************************
C
C
C VERSION SIMD/CM2-1.00
C ==================================================
C
INCLUDE '/usr/include/cm/paris-configuration-fort.h'
INTEGER KASES,NS,NT
PARAMETER (KASES=5)
INTEGER N(KASES),M(KASES)
cmf$ layout N (:serial)
cmf$ layout M (:serial)
DATA N / 64,1024,64,256,128 /
DATA M / 128,64,1024,256,4092 /
INTEGER NABOVE
REAL AVER,AVERTOP,LOWABO
LOGICAL GENIUS
DO 50 K = 1, KASES
CALL CM_TIMER_CLEAR(0)
CALL CM_TIMER_START(0)
DO MANY=1,200
NS=N(K)
NT=M(K)
CALL DOIT(NS,NT,AVER,AVERTOP,GENIUS,NABOVE,LOWABO)
ENDDO
CALL CM_TIMER_STOP(0)
PRINT 60, NS,NT
60 FORMAT ('PROBLEM 5 WITH ',I6,' STUDENTS AND ',I6,' TESTS')
PRINT *,'AVERAGE TEST SCORE .....:',AVER
PRINT *,'# SCORES ABOVE AVERAGE..:',NABOVE
PRINT *,'AVERAGE ABOVE ..........:',AVERTOP
PRINT *,'LOWEST SCORE ABOVE .....:',LOWABO
PRINT *,'THERE IS GENIUS ........:',GENIUS
CALL CM_TIMER_PRINT(0)
50 CONTINUE
c STOP
END
SUBROUTINE DOIT(NS,NT,AVER,AVERTOP,GENIUS,NABOVE,LOWABO)
INTEGER NABOVE
REAL AVER,AVERTOP,LOWABO
LOGICAL GENIUS
REAL, ARRAY(NT,NS) :: SCORES
LOGICAL, ARRAY(NT,NS) :: ABOVE
LOGICAL, ARRAY(NS) :: GEN_TMP
SCORES=60.0+40.0*SIN(SPREAD([1:NT],2,NS)*
+ SPREAD([1:NS],1,NT)*0.0006321)
SSUM=SUM(SCORES)
AVER=SSUM/(NS*NT)
ABOVE = (SCORES.GT.AVER)
WHERE(ABOVE)
SCORES=SCORES*1.1
ENDWHERE
NABOVE=COUNT(ABOVE)
c AVERTOP=SUM(SCORES,MASK=ABOVE)/NABOVE
c LOWABO=MINVAL(SCORES,MASK=ABOVE)
avertop = 0.0
lowabo = 100000.0
!HPF$ independent, local_access
do j = 1, NS
do i = 1, NT
if (above(i,j)) then
reduce (sum, avertop, scores(i,j))
reduce (minval, lowabo, scores(i,j))
end if
end do
end do
avertop = avertop / NABOVE
c GENIUS=ANY(ALL(ABOVE,DIM=1))
!HPF$ INDEPENDENT, LOCAL_ACCESS
do j = 1, NS
c gen_tmp (j) = all (above(1:NT,j))
gen_tmp (j) = .true.
do i = 1, NT
gen_tmp (j) = (gen_tmp (j) .and. above(i,j))
end do
end do
GENIUS = ANY (gen_tmp)
c RETURN
END